// ----------------------------------
// RSDK Project: Sonic Essence
// Script Description: Fence
// Script Author: Tails LP, Xanman
// ----------------------------------

// Aliases
private alias 24 : TYPE_FENCE

// Function declarations
reserve function Fence_DebugDraw
reserve function Fence_DebugSpawn

function Fence_DebugDraw
	DrawSprite(0)
end function


function Fence_DebugSpawn
	CreateTempObject(TypeName[Fence], 0, object.xpos, object.ypos)
	object[tempObjectPos].drawOrder = 6
end function


event ObjectMain
	object.priority = PRIORITY_ACTIVE
end event


event ObjectDraw
		temp3 = 0
		while temp3 <= object.propertyValue

			temp0 = object.xpos


			temp1 = 0x380000
			temp1 *= temp3
			temp0 -= temp1


			temp2 = object.propertyValue
			temp2 *= 0x1C0000
			temp0 += temp2

			DrawSpriteXY(0, temp0, object.ypos)
			temp3 ++
		loop
end event


event ObjectStartup

	LoadSpriteSheet("WIZ/Objects.gif")


	// Ring frames

	SpriteFrame(-32, -9, 64, 18, 1, 493)





	// Add the Ring to the debug mode object list
	SetTableValue(TypeName[Fence], DebugMode_ObjCount, DebugMode_TypesTable)
	SetTableValue(Fence_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
	SetTableValue(Fence_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
	DebugMode_ObjCount++
	
end event

event RSDKDraw
	DrawSprite(0)
end event

event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 1, 143)
end event
